package com.etc.controller;

import com.etc.pojo.Orders;
import com.etc.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.PrintWriter;

/**
 * @author 杰哥
 * @Title: OrderController
 * @ProjectName myssm
 * @Description: TODO
 * @date 2019/8/516:01
 */
@Controller
@RequestMapping("orders")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @RequestMapping(value = "insert",method = RequestMethod.POST)
    public void insert(
            @RequestParam (value = "cid")int cid,
            @RequestParam (value = "shopId")int shopId,
            @RequestParam (value = "siteId")int siteId,
            @RequestParam (value = "times")String times,
            @RequestParam (value = "price")int price,
            @RequestParam (value = "numbers")int numbers,
            @RequestParam (value = "represent")String represent,
            PrintWriter out){
        Integer insert = orderService.insert(new Orders(cid,shopId,siteId,times,price,numbers,represent));
        if(insert == 1){
            out.print(1);
        }else {
            out.print(0);
        }

    }


}
